$(function () {
    showClazz()
});


Vue.component('v-select', VueSelect.VueSelect);
var vm = new Vue({
    el:'#rrapp',
    data:{
        showStuList: false,
        showList: true,

        title:"班级列表",


    },
    methods: {
        query: function () {

            vm.reload();
        },reload: function () {
            vm.showList = true;
            var page = $("#jqGrid").jqGrid('getGridParam','page');

            $("#jqGrid").jqGrid('setGridParam',{

            }).trigger("reloadGrid");
                page:page
        }
    }
});
function querystu(e){
   window.location.href="query.html?"+e;

}

function  showClazz(){
    $("#jqGrid").jqGrid('clearGridData');
    $("#jqGrid").jqGrid({
        url: baseURL + 'guide/clazzQuery',
        datatype: "json",
        colModel: [
            { label: 'ID', name: 'id', hidden: true, index: "id",  key: true },

            { label: '专业', name: 'dname',  width: 80 },
            { label: '班级', name: 'bname',  width: 40 },
            { label: '班主任', name: 'hname', width: 80 },
            { label: '人数', name: 'renshu',  width: 40  },
            { label: '学生列表',formatter:function(value,options,rowData){

                    return '<b><span  onclick="querystu('+rowData.id+')"  style="cursor:pointer;" class="label label-success">查看</span></b> ';

                }
            }

        ],
        viewrecords: true,

        autowidth:true,
        multiselect: true,
        height: 385,
        rowNum: 10,
        rowList : [10,30,50],
        rownumbers: true,
        rownumWidth: 25,
        autowidth:true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page",
            rows:"limit",
            order: "order"
        },
        gridComplete:function(){
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
        }
    }).trigger("reloadGrid");
}
